package com.java8.Stream;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class demo01_初识 {
    @Test
    public void  test1(){
        ArrayList<String> list1 = new ArrayList<>(
                List.of("张三丰","张无忌","张翠山","王二麻子","张良","谢广坤"));
        //打印出姓"张"而且长度为3的名
        list1.stream()
                .filter(s->s.startsWith("张"))
                .filter(s->s.length()==3)
                .forEach(s -> System.out.println(s));
    }
}
